<?
$checked = "checked='checked'";
$mon = $tue = $wed = $thu = $fri = $sat = $sun = "";

if (isset($defaults)){
    //Set defaults for the checked buttons
    if ($defaults->default_monday == 1){
        $mon = $checked;
    }
    if ($defaults->default_tuesday == 1){
        $tue = $checked;
    }
    if ($defaults->default_wednesday == 1){
        $wed = $checked;
    }
    if ($defaults->default_thursday == 1){
        $thu = $checked;
    }
    if ($defaults->default_friday == 1){
        $fri = $checked;
    }
    if ($defaults->default_saturday == 1){
        $sat = $checked;
    }
    if ($defaults->default_sunday == 1){
        $sun = $checked;
    }
}
?>
<div class="preview">
<h2>Server Time: <?=date("F j, Y, g:i a")?></h2>
</div>
<div class="left">
<div class="form_section">
    <div class="title">Default Meal Vote Cutoff Time: </div>
<select id="serving_time">
    <?foreach($times as $id =>$time):?>
    <option value="<?=$id?>"<?if ($time == $defaults->default_servetime):?>
            selected="selected"
            <?endif;?>><?=date('g:i A',strtotime($time))?></option>
    <?endforeach;?>
</select>
<br/>
<br/>
<div class="title">Default Meal Order Cutoff Time: </div>
<select id="cutoff_time">
    <?foreach($times as $id => $time):?>
    <option value="<?=$id?>"<?if ($time == $defaults->default_cutoff):?>
            selected="selected"
            <?endif;?>><?=date('g:i A',strtotime($time))?></option>
    <?endforeach;?>
</select>
</div>
<div class="form_section preview centered" id="order_active">
    <h1>Order Service Active:</h1>
    <input class="check_large" type="checkbox" id="service_active"
           <?if($defaults->default_orders == 1){echo "checked='checked'";}?>/>
</div>
</div>
<div class="right">
<div class="form_section">
<div class="title">Default Order Days:</div>
<div class="title">
    <table id="order_days">
<tr><td>Monday:</td><td><input class="check" type="checkbox" <?=$mon?> id="cb_mon"/></td></tr>
<tr><td>Tuesday:</td><td><input class="check" type="checkbox" <?=$tue?> id="cb_tue"/></td></tr>
<tr><td>Wednesday:</td><td><input class="check" type="checkbox" <?=$wed?> id="cb_wed"/></td></tr>
<tr><td>Thursday:</td><td><input class="check" type="checkbox" <?=$thu?> id="cb_thu"/></td></tr>
<tr><td>Friday:</td><td><input class="check" type="checkbox" <?=$fri?> id="cb_fri"/></td></tr>
<tr><td>Saturday:</td><td><input class="check" type="checkbox" <?=$sat?> id="cb_sat"/></td></tr>
<tr><td>Sunday:</td><td><input class="check" type="checkbox" <?=$sun?> id="cb_sun"/></td></tr>
    </table>
</div>
</div>
</div>
<br style="clear:both"/>
<br/>
<div id="button_section">
<input type="button" class="button" id="save_settings" value="Save Settings"/> 
<input type="button" class="button" id="cancel_settings" value="Cancel Settings"/>
</div>